package com.centit.framework.ip.businessdata.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.centit.framework.ip.businessdata.dao.InterfaceManagerDao;
import com.centit.framework.ip.businessdata.po.InterfaceManager;
import com.centit.framework.ip.businessdata.service.InterfaceManagerManager;
import com.centit.framework.jdbc.service.BaseEntityManagerImpl;
import com.centit.support.database.utils.PageDesc;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * InterfaceManager  Service.
 * create by scaffold 2018-05-22
 *
 * @author guo_jh
 * T_INTERFACE_MANAGER业务系统接口配置信息表
 */
@Service
public class InterfaceManagerManagerImpl
        extends BaseEntityManagerImpl<InterfaceManager, String, InterfaceManagerDao>
        implements InterfaceManagerManager {

    public static final Log log = LogFactory.getLog(InterfaceManagerManager.class);


    private InterfaceManagerDao interfaceManagerDao;

    @Resource(name = "interfaceManagerDao")
    @NotNull
    public void setInterfaceManagerDao(InterfaceManagerDao baseDao) {
        this.interfaceManagerDao = baseDao;
        setBaseDao(this.interfaceManagerDao);
    }

    /**
     * 获取系统信息集合
     * @param filterMap
     * @param pageDesc
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public JSONArray listObjectsAsJson(Map<String, Object> filterMap, PageDesc pageDesc) {
        return this.interfaceManagerDao.listObjectsAsJson(filterMap, pageDesc);
    }

    /**
     * 获取接口信息
     * @param filterMap 筛选条件
     * @return
     */
    @Override
    public JSONObject getObjectAsJson(Map<String, Object> filterMap) {
        return this.interfaceManagerDao.getObjectAsJson(filterMap);
    }

    @Override
    public JSONArray listBySqlAsJson(String sql, Map<String, Object> filterMap) {
        return this.interfaceManagerDao.listBySqlAsJson(sql,filterMap);
    }

    @Override
    public JSONArray listObjectsAsJsonArray(Map<String, Object> filterMap, PageDesc pageDesc) {
        return this.interfaceManagerDao.listObjectsAsJsonArray(filterMap,pageDesc);
    }

}

